package com.boot.security.server.dao.mffl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.mffl.MfflConfig;

@Mapper
public interface MfflConfigDao {

    @Select("select * from mffl_config t where t.id = #{id}")
    MfflConfig getById(Long id);

    @Delete("delete from mffl_config where id = #{id}")
    int delete(Long id);

    int update(MfflConfig mfflConfig);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into mffl_config(name, value, description, createTime, updateTime) values(#{name}, #{value}, #{description}, #{createTime}, #{updateTime})")
    int save(MfflConfig mfflConfig);
    
    int count(@Param("params") Map<String, Object> params);

    List<MfflConfig> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);


    //按name查询
    @Select("SELECT * FROM mffl_config t WHERE t.`name` = #{name}")
    MfflConfig getByName(@Param("name") String name);

    //按name模糊查询
    @Select("SELECT * FROM mffl_config t WHERE t.`name` like CONCAT('%',#{name},'%')")
    List<MfflConfig> getLikeName(@Param("name") String name);
}
